FROM node:20-slim


WORKDIR /root
COPY . .
# 删除旧的
RUN rm -rf workspace
# 写入新的源地址
RUN cat <<EOF > /etc/apt/sources.list
deb http://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian-security bookworm-security main contrib non-free non-free-firmware
EOF


# 确保文件权限正确
RUN chmod 644 /etc/apt/sources.list

RUN npm install -g @vue/cli \
    && yarn config set registry https://registry.npmmirror.com \
    && vue create --default workspace \
    && cd workspace \
    && npm install

RUN apt-get update
RUN apt-get install curl -y
RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.6.17/uv-installer.sh | sh

ENV UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple
# 切换到新创建的工作区目录
WORKDIR /root/workspace
# 暴露端口
EXPOSE 8080
# 启动应用
CMD ["npm", "run", "serve"]
